package game.johan.engine;

/*
Copyright (C) 2013 Johan Ceuppens

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

import java.util.Random;
import java.io.*;
import javax.imageio.ImageIO;
import java.awt.image.*;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.awt.*;
import javax.swing.*;

import java.awt.*;
import javax.swing.*;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsEnvironment;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.Timer;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsEnvironment;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.Timer;

class SurfaceTileMap
{
	private int _tilew = 16, _tileh = 16;

	SurfaceTileFetcher _surfacetilefetcher = new SurfaceTileFetcher();

	public SurfaceTileMap() {
		int x = 0, y = 0;
		for ( ; y < 10*_tileh; y+=_tileh) {
			for ( ; x < 10*_tilew; x+=_tilew) {
				SurfaceTile tilegrass1 = new SurfaceTile("tilegrass1-16x16.png", x,y,_tilew,_tileh);
				SurfaceTile tilegrass2 = new SurfaceTile("tilegrass2-16x16.png", x,y,_tilew,_tileh);
				Random r = new Random();
				if (r.nextInt(3) == 0)
					_surfacetilefetcher.put(tilegrass2);
				else
					_surfacetilefetcher.put(tilegrass1);
		//Tile._tilesdict.lookup("SurfaceTile0"); 	
			}
			x = 0;
		}
	}

	public int size() {
		return _surfacetilefetcher.size();
	}

	public SurfaceTile get() {
		return _surfacetilefetcher.get();
	} 

}


